<meta charset="utf-8">

<div class="box box-primary" id="pmpTasks_check">
	<form role="form" id="pmpTasks_check_editForm" >
		<div class="box-body">
				<div class="form-group" style="height: 60px;">
					<label for="title">验收结果:</label><br> 
					<input type="radio" name="isOk" v-model="isOk" value="6" checked="checked"> 验收通过
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="radio" name="isOk"  v-model="isOk"   value="5"  > 不通过
			  	</div>
					<div class="form-group" v-if="isOk==5" style="height: 120px;">
						<label for="title">不通过原因</label>
					    <textarea rows="5" cols="" name="rejectResaon" v-model="rejectResaon" class="form-control" id="rejectResaon" required>
					</textarea>
					</div>
		</div>
		
		<div class="box-footer">
			<button type="button" class="btn btn-default" v-on:click="cancel">取消</button>
			<button type="button" class="btn btn-info pull-right" v-on:click="doAsign">提交</button>
		</div>
		
	</form>
</div>
<script type="text/javascript">
	new Vue({
			el : '#pmpTasks_check',
			data : {
				 projectId: project_detail_main.$data.projectId,
				 taskId: zfesLayerEditDg.getLayerParam().id,
				 isOk: 5,
				 rejectResaon: null,
				bus : new Vue()
			},
			mounted : function() {
				var _this = this;
				setTimeout(function(){ _this.isOk=6; }, 100);
			},
			methods : {
				doAsign : function() {
					if ($("#pmpTasks_check_editForm").valid()) {
						var _this = this;
				        var url = "/pmp/service/pm/pmpTasks/checkTask";
				        if(_this.isOk==5){
				        	if(!rejectResaon){
				        		 alertSwal.warning("请输入不通过原因");
				        		 return;
				        	}
				        }
				       zfesAjax.ajaxTodo(url, {"id":_this.taskId,"isOk": _this.isOk,rejectResaon:_this.rejectResaon}, function(data) {
				    	   alertSwal.successText(data.message);
							layer.close(layer.index);
				       });
					}
				},
				cancel : function() {
					layer.close(layer.index);
				}
			}
		});
</script>
